Imports System.ComponentModel

Public Class ApplicationWrapperBase
	Inherits RootObjectWrapperBase

	<Description("Construcotr.")> _
	Public Sub New(<Description("Native (COM+) object.")> ByVal nativeObject As Object)
		MyBase.New(nativeObject)
	End Sub

	Private m_QuitCalled As Boolean
	Public ReadOnly Property QuitCalled() As Boolean
		Get
			Return Me.m_QuitCalled
		End Get
	End Property

	Private Sub Quit(ByVal callDispose As Boolean)
		Dim nativeObject As Object = Me.WrappedObject
		If nativeObject IsNot Nothing Then
			nativeObject.Quit()
		End If

		If callDispose Then
			Me.Dispose()
		End If
	End Sub

	Public Sub Quit()
		Me.Quit(True)
	End Sub

	Protected Overrides Sub DisposeInternal()
		If False = Me.m_QuitCalled Then
			Me.Quit(False)
		End If

		MyBase.DisposeInternal()
	End Sub
End Class
